﻿/*
 * timer.c
 *
 * Created: 28.02.2013 23:03:55
 *  Author: Øyvind
 */ 
#include "timer.h"
#include <avr/io.h>


void timer_init(){
	//Clock select
	TCCR1B |= (1 << WGM12); // Timer in CTC mode (invokes interrupt when count finish)
	TCCR1B |= (1 << CS12) | (1 << CS10); //Prescale clk/1024 and start clock
	OCR1A = 1*10000; //~seconds
	TIMSK1 |= (1 << OCIE1A); // Enable interupt
}